<?php

declare(strict_types=1);

namespace App\Request\auth;

use Hyperf\Validation\Request\FormRequest;

/**
 * 菜单验证器
 */
class MenuRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'parent_id' => 'required|integer',
            'name' => 'required|string',
//            'path' => 'required|string',
//            'component' => 'required|string',
//            'permission' => 'required|string',

        ];
    }

    public function messages(): array
    {
        return [
            'parent_id.required' => '请选择上级菜单',
            'name.required' => '请输入菜单名称',
//            'path.required' => '请输入菜单路径',
//            'component.required' => '请输入菜单组件',
            'type.required' => '请选择菜单类型',
//            'permission.required' => '请输入菜单权限',

            'parent_id.integer' => '上级菜单格式错误',
            'name.string' => '菜单名称格式错误',
//            'path.string' => '菜单路径格式错误',
//            'component.string' => '菜单组件格式错误',
            'type.integer' => '菜单类型格式错误',
//            'permission.string' => '菜单权限格式错误',
        ];
    }
}
